<%--
  - Author		:	Jaewon Choi
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});
		</script>
	</head>
	<body>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="menuTitle">
					이슈상세보기
				</div>
				<form id="frm" name="frm" method="post" action="<c:url value="/ad/form.do" />">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchDate" value="${param.searchDate}">
					<input type="hidden" name="startDate" value="${param.startDate}" /> 
					<input type="hidden" name="endDate" value="${param.endDate}" />
					<input type="hidden" name="searchName" value="${param.searchName}" />
					<input type="hidden" name="searchAdCategoryId" value="${param.searchAdCategoryId}" />
					
					<table class="frmTbl">
						<colgroup>
							<col width="176px;" />
							<col width="100px;" />
							<col width="*" />
						</colgroup>
						<tbody>
							<tr>
								<th>이슈 IDX</th>
								<td colspan="2">
									${advertising.idx}
									<input type="hidden" name="idx" value="${advertising.idx}">
								</td>
							</tr>
							<!-- 
							<tr>
								<th>구분</th>
								<td colspan="2">
									<c:forEach items="${adCategoryList}" var="adCategory">
										<label>
											<input type="checkbox" name="adCategoryIdx" value="${adCategory.idx}" disabled="disabled" <c:if test="${not empty advertising.idx && adCategory.adIdx eq advertising.idx}">checked="checked"</c:if>>
											${adCategory.name}
										</label>	
									</c:forEach>
								</td>
							</tr>						
							 <tr>
								<th>브랜드</th>
								<td colspan="2">
									<c:out value="${advertising.categoryNm}" />
								</td>
							</tr>
								 -->
							<tr>
								<th>이슈명</th>
								<td colspan="2">
									<c:out value="${advertising.name}" />
								</td>
							</tr>
							<tr>
								<th>기간</th>
								<td colspan="2">
									<c:choose>
										<c:when test="${empty advertising.beginTime and  empty advertising.endTime}">
											항상
										</c:when>
										<c:otherwise>
											<c:catch var="e">
												<fmt:parseDate var="beginTime" pattern="yyyy-MM-dd HH:mm:ss" value="${advertising.beginTime}" />
												<fmt:formatDate value="${beginTime}" pattern="yyyy-MM-dd" />
											</c:catch>
											<c:if test="${not empty e}">
												${advertising.beginTime}
											</c:if>
											~
											<c:catch var="e">
												<fmt:parseDate var="endTime" pattern="yyyy-MM-dd HH:mm:ss" value="${advertising.endTime}" />
												<fmt:formatDate value="${endTime}" pattern="yyyy-MM-dd" />
											</c:catch>
											<c:if test="${not empty e}">
												${advertising.endTime}
											</c:if>
										</c:otherwise>
									</c:choose>
								</td>
							</tr>
							<c:forEach items="${adFileList}" var="adFile">
								<c:if test="${adFile.fileType eq 'adImg'}">
									<tr>
										<th>이미지</th>
										<td colspan="2">
											<img src="<c:out value="${adFile.fileUrl}" />" class="thumbnailImg" />
										</td>
									</tr>
									<tr>
										<th rowspan="2">이슈 링크</th>
										<td colspan="2">
											<c:choose>
												<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'CO'}">컨텐츠</c:when>
												<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'IL'}">URL</c:when>
												<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'N'}">이동하지 않음</c:when>
											</c:choose>
										</td>
									</tr>
									<tr class="fileDataTr IL OL">
										<c:choose>
											<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'CO'}">
												<td>
													컨텐츠IDX
												</td>
												<td>
													<c:out value="${fn:split(adFile.fileData, '^')[1]}" />
												</td>
											</c:when>
											<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'IL' or fn:split(adFile.fileData, '^')[0] eq 'OL'}">
												<td>
													URL
												</td>
												<td>
													<c:out value="${fn:split(adFile.fileData, '^')[1]}" />
												</td>
											</c:when>											
											<c:when test="${fn:split(adFile.fileData, '^')[0] eq 'N'}">
												<td>
													이동하지 않음
												</td>
												<td>
												</td>
											</c:when>
										</c:choose>
									</tr>
									<!-- 
									<tr>
										<th rowspan="2">URL 타입 *</th>
										<td colspan="2">
											<c:choose>
												<c:when test="${advertising.urlType eq '01'}">내부</c:when>
												<c:when test="${advertising.urlType eq '02'}">외부</c:when>
											</c:choose>											
										</td>
									</tr>
									 -->
								</c:if>
							</c:forEach>
						</tbody>
					</table>
					<input type="button" class="btn" value="목록" onclick="javascript:document.listFrm.submit();" />
					<input type="submit" class="btn" value="수정" />
				</form>
				<form name="listFrm" action="<c:url value="/ad/list.do" />" method="post" style="display: none;">
					<input type="hidden" name="maxnum" value="${param.maxnum}" />
					<input type="hidden" name="page" value="${param.page}" />
					<input type="hidden" name="searchDate" value="${param.searchDate}">
					<input type="hidden" name="startDate" value="${param.startDate}" /> 
					<input type="hidden" name="endDate" value="${param.endDate}" />
					<input type="hidden" name="name" value="${param.searchName}" />
					<input type="hidden" name="adCategoryId" value="${param.searchAdCategoryId}" />
				</form>
			</div>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
		</div>
	</body>
</html> 